package com.cy.springcloudalibaba;

import com.cy.springcloudalibaba.consumer.ReceiverService;
import com.cy.springcloudalibaba.producer.SendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.cloud.stream.messaging.Source;

/**
 * @Description: spring cloud stream
 * @ClassName: RocketStreamApplication
 * @Author: chenyu
 * @Date: 2025/1/10 10:38
 */
@EnableBinding(value = {Source.class, Sink.class})
@SpringBootApplication
public class RocketStreamApplication implements CommandLineRunner {

    @Autowired
    private SendService sendService;

    @Autowired
    private ReceiverService receiverService;
    
    public static void main(String[] args) {
        SpringApplication.run(RocketStreamApplication.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        sendService.send("hello spring cloud stream rocketmq;");
        receiverService.receive();
    }
}
